package com.gxa.controller;

import com.gxa.pojo.ModSet;
import com.gxa.utils.Constants;
import com.gxa.utils.ResponseData;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * User: tx
 * Date: 2020/11/26 15:44
 * Description:
 * Version: V1.0
 */
@RestController
@Api(value = "配送方式设置",tags = "配送方式设置")
@RequestMapping(value = "options")
public class DistributeController {

    @Autowired
    private ResponseData responseData;
    @Autowired(required = false)
    private Constants constants;

    @PostMapping("/addDistributeOptions")
    @ApiOperation(value = "添加配送方式",notes = "根据提交的信息添加配送方式",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "添加成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "添加失败")
    })
    public ResponseData addDistributeOptions(@RequestBody @ApiParam(name = "modSet",value = "配送方式",required = true) ModSet modSet){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("添加成功");
        responseData.setData(modSet);
        return responseData;
    }



    @GetMapping("/delDistributeOptions")
    @ApiOperation(value = "是否启用配送方式",notes = "根据提交的信息是否启用配送方式",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "操作失败")
    })
    public ResponseData delDistributeOptions(@ApiParam(name = "modStatu",value = "配送方式id",required = true) int modStatu){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("操作成功");
        responseData.setData(modStatu);
        return responseData;
    }




    @GetMapping("/updateDistributeOptions")
    @ApiOperation(value = "修改配送方式",notes = "根据提交的信息修改配送方式",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "修改成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "修改失败")
    })
    public ResponseData updateDistributeOptions(@ApiParam(name = "modId",value = "配送方式id",required = true) int modId){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("修改成功");
        responseData.setData(modId);
        return responseData;
    }





    @PostMapping("/queryDistributeOptions")
    @ApiOperation(value = "查询配送方式",notes = "根据提交的信息查询配送方式",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "查询成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "查询失败")
    })
    public ResponseData queryDistributeOptions(@ApiParam(name = "modSet",value = "配送方式",required = true) ModSet modSet){
        modSet.setModStatu(1);
        modSet.setModName("天天快递");
        modSet.setModValue("500");
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(modSet);
        return responseData;
    }
}
